import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

import java.awt.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Microsoft
 * Date: 2023-02-02
 * Time: 16:35
 */
class Alg {
    public static <E extends Comparable<E>> E findMax(E[] array) {
        E max = array[0];
        for (int i = 1; i < array.length; i++) {
            if(max.compareTo(array[i]) < 0) {
                max = array[i];
            }
        }
        return max;
    }
}
public class Test {
    public static void main(String[] args) {
        Integer[] arr = {1,2,3,4,5};
        Integer val = Alg.<Integer>findMax(arr);  //<Integer>可以省略
        System.out.println(val);
    }
}


